---
id: 64df45a3ad4f8719e5355244
title: Passo 46
challengeType: 20
dashedName: step-46
---

# --description--

The steps of moving `n - 1` disks can be broken down further until only a single disk is considered. This will be the first move occurring. After the first move occurs, the following moves are generated by the unwinding of the recursive calls. Keep in mind that in each recursive step the role played by the rods changes between source, target, and auxiliary.

For now, each recursive call prints the `rods` dictionary without performing any changes to the lists. Before the `print()` call, remove the last element from the `rods[source]` list and append it to the `rods[target]` list.

# --hints--

You should remove the last element from the `rods[source]` list and append it to the `rods[target]` list before the `print` call.

```js
({ test: () => assert.match(code, /move\(\s*n\s*-\s*1\s*,\s*source\s*,\s*auxiliary\s*,\s*target\s*\)\s+rods\s*\[\s*target\s*\]\s*\.append\(\s*rods\s*\[\s*source\s*\]\s*\.pop\(\s*\)\s*\)/) })
```

# --seed--

## --seed-contents--

```py
NUMBER_OF_DISKS = 4
rods = {
    'A': list(range(NUMBER_OF_DISKS, 0, -1)),
    'B': [],
    'C': []
}

--fcc-editable-region--
def move(n, source, auxiliary, target):
    if n > 0:
        # move n - 1 disks from source to auxiliary, so they are out of the way
        move(n - 1, source, auxiliary, target)

        # display starting configuration
        print(rods, '\n')

--fcc-editable-region--
# initiate call from source A to target C with auxiliary B
move(NUMBER_OF_DISKS, 'A', 'B', 'C')
```
